<?php
/**
 * ImpSoft Cart Row Model
 * 
 * @package ImpSoft
 * @subpackage ImpSoft Models
 * @copyright Luke Visinoni (luke.visinoni@gmail.com)
 * @author Luke Visinoni (luke.visinoni@gmail.com)
 * @license GNU Lesser General Public License
 */
class CartRow extends ImpSoft_Db_Table_Row {
	
	protected $_items = array();
	
	/**
	 * AddProduct
	 * Adds a simple product to the cart. Eventually, there will probably need
	 * to be ways to add bundles and other types of things to the cart, but for
	 * now, this will work.
	 */
	public function addProduct($product_id, $quantity = 1) {
	
		$prodTbl = new Product;
		$itemTbl = new CartItem;
		try {
			$product = $prodTbl->find($product_id);
			$product = $product->current();
		} catch (Zend_Db_Exception $e) {
			return false; // @todo: ?
		}
		$this->_items[] = $itemTbl->createRow(array(
			'product_id' => $product_id,
			'quantity' => $quantity
		));
	
	}

}